#ifndef _Differentiator_H
#define _Differentiator_H

#include "Token.h"
#include "TokenNode.h"
#include "Parser.h"

#include <list>
using std::list;

class Differentiator
{
public:  
    Differentiator(TokenNode const* p, string const & var);		
	
	typedef list<Token>::const_iterator const_list_iterator;
	typedef list<Token>::iterator list_iterator;
	const_list_iterator begin() const;
	const_list_iterator end()   const;
	
private:	
	list <Token> tokens_res;

	bool Diff (TokenNode const* p, string const & var);	

	bool DiffSum(TokenNode const* p, string const & var);
	bool DiffMult(TokenNode const* p, string const & var);
	bool DiffDiv(TokenNode const* p, string const & var);
	bool DiffNumber();
	bool DiffVariable(TokenNode const* p, string const & var);

	void Push(TokenNode const* p);
	void deleteBrackets();
};

typedef list<Token>::const_iterator const_list_iterator;
void printTokensResult(const_list_iterator begin, const_list_iterator end);

#endif
